<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=PresentationFramework"
    xmlns:uia="clr-namespace:Thinktecture.DataForm"
    xmlns:ctl="clr-namespace:Thinktecture.DataForm.Controls"
    xmlns:local="clr-namespace:Thinktecture.DataForm">

    <!--Value Converters-->
    <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
    <local:ReverseBooleanToVisibilityConverter x:Key="ReverseBooleanToVisibilityConverter" />
    <local:ReverseBooleanConverter x:Key="ReverseBooleanConverter" />

    <!--Marker Drawing Color-->
    <SolidColorBrush x:Key="MarkerDrawingColor" Color="#FF595959" />
    <SolidColorBrush x:Key="ErrorDrawingColor" Color="White" />
    
    <!--DataForm DropShadow-->
    <DropShadowEffect x:Key="DataFormDropShadow" Color="Black" Direction="320" ShadowDepth="3" Opacity="0.5"/>

    <!--None Marker-->
    <DrawingGroup x:Key="NoneMarker">
    </DrawingGroup>

    <!--Edit Tracker-->
    <DrawingGroup x:Key="EditTracker">
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource MarkerDrawingColor}" Thickness="0.4" StartLineCap="Triangle" EndLineCap="Round"/>
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <LineGeometry StartPoint="0.6,0.9" EndPoint="1,0" />
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource MarkerDrawingColor}" Thickness="0.1" StartLineCap="Triangle" EndLineCap="Round" DashCap="Flat">
                    <Pen.DashStyle>
                        <DashStyle Dashes="1"/>
                    </Pen.DashStyle>
                </Pen>
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <LineGeometry StartPoint="0.2,1" EndPoint="0.6,1" />
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource MarkerDrawingColor}" Thickness="0.15" StartLineCap="Round" EndLineCap="Round" />
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <RectangleGeometry Rect="0,0.4,0.9,1" />
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
    </DrawingGroup>

    <!--Field Tracker-->
    <DrawingGroup x:Key="FieldTracker">
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource MarkerDrawingColor}" Thickness="0.3" StartLineCap="Round" EndLineCap="Triangle" />
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <LineGeometry StartPoint="0,0.5" EndPoint="0.9,0.5" />
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource MarkerDrawingColor}" Thickness="0.3" StartLineCap="Round" EndLineCap="Round" />
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <LineGeometry StartPoint="0.5,0" EndPoint="1,0.5" />
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource MarkerDrawingColor}" Thickness="0.3" StartLineCap="Round" EndLineCap="Round" />
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <LineGeometry StartPoint="1,0.5" EndPoint="0.5,1" />
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
    </DrawingGroup>

    <!--Required Field Marker-->
    <DrawingGroup x:Key="RequiredFieldMarker">
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource MarkerDrawingColor}" Thickness="0.08" StartLineCap="Round" EndLineCap="Round" />
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <LineGeometry StartPoint="0.4,0.4" EndPoint="0.6,0.6" />
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource MarkerDrawingColor}" Thickness="0.08" StartLineCap="Round" EndLineCap="Round" />
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <LineGeometry StartPoint="0.4,0.6" EndPoint="0.6,0.4" />
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
    </DrawingGroup>

    <!--Error Marker-->
    <DrawingGroup x:Key="ErrorMarker">
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource MarkerDrawingColor}" Thickness="0.5" StartLineCap="Round" EndLineCap="Triangle" />
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <LineGeometry StartPoint="0.5,0.1" EndPoint="0.5,0.38" />
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource MarkerDrawingColor}" Thickness="0.5" StartLineCap="Round" EndLineCap="Round" />
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <LineGeometry StartPoint="0.5,0.9" EndPoint="0.5,0.9" />
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource MarkerDrawingColor}" Thickness="0.4" StartLineCap="Round" EndLineCap="Round" />
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <EllipseGeometry Center="0.5,0.5" RadiusX="1" RadiusY="1"/>
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
    </DrawingGroup>

    <!--Info Marker-->
    <DrawingGroup x:Key="InfoMarker">
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource MarkerDrawingColor}" Thickness="0.45" StartLineCap="Round" EndLineCap="Round" />
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <LineGeometry StartPoint="0.5,0.6" EndPoint="0.5,0.95" />
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource MarkerDrawingColor}" Thickness="0.45" StartLineCap="Round" EndLineCap="Round" />
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <LineGeometry StartPoint="0.5,0.08" EndPoint="0.5,0.08" />
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource MarkerDrawingColor}" Thickness="0.3" StartLineCap="Round" EndLineCap="Round" />
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <EllipseGeometry Center="0.5,0.5" RadiusX="1" RadiusY="1"/>
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
    </DrawingGroup>

    <!--Error Marker Footer-->
    <DrawingGroup x:Key="ErrorMarkerFooter">
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource ErrorDrawingColor}" Thickness="0.5" StartLineCap="Round" EndLineCap="Triangle" />
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <LineGeometry StartPoint="0.5,0.1" EndPoint="0.5,0.38" />
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource ErrorDrawingColor}" Thickness="0.5" StartLineCap="Round" EndLineCap="Round" />
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <LineGeometry StartPoint="0.5,0.9" EndPoint="0.5,0.9" />
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource ErrorDrawingColor}" Thickness="0.4" StartLineCap="Round" EndLineCap="Round" />
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <EllipseGeometry Center="0.5,0.5" RadiusX="1" RadiusY="1"/>
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
    </DrawingGroup>
    
    <!--Move First-->
    <DrawingGroup x:Key="MoveFirst">
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource MarkerDrawingColor}" Thickness="0.3" StartLineCap="Round" EndLineCap="Round" />
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <LineGeometry StartPoint="0.5,0.5" EndPoint="1,0" />
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource MarkerDrawingColor}" Thickness="0.3" StartLineCap="Round" EndLineCap="Round" />
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <LineGeometry StartPoint="0.5,0.5" EndPoint="1,1" />
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource MarkerDrawingColor}" Thickness="0.3" StartLineCap="Round" EndLineCap="Round" />
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <LineGeometry StartPoint="0.1,0" EndPoint="0.1,1" />
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
    </DrawingGroup>

    <!--Move Previous-->
    <DrawingGroup x:Key="MovePrevious">
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource MarkerDrawingColor}" Thickness="0.3" StartLineCap="Round" EndLineCap="Round" />
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <LineGeometry StartPoint="0,0.5" EndPoint="0.5,0" />
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource MarkerDrawingColor}" Thickness="0.3" StartLineCap="Round" EndLineCap="Round" />
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <LineGeometry StartPoint="0,0.5" EndPoint="0.5,1" />
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
    </DrawingGroup>

    <!--Move Next-->
    <DrawingGroup x:Key="MoveNext">
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource MarkerDrawingColor}" Thickness="0.3" StartLineCap="Round" EndLineCap="Round" />
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <LineGeometry StartPoint="0,0" EndPoint="0.5,0.5" />
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource MarkerDrawingColor}" Thickness="0.3" StartLineCap="Round" EndLineCap="Round" />
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <LineGeometry StartPoint="0,1" EndPoint="0.5,0.5" />
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
    </DrawingGroup>

    <!--Move Last-->
    <DrawingGroup x:Key="MoveLast">
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource MarkerDrawingColor}" Thickness="0.3" StartLineCap="Round" EndLineCap="Round" />
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <LineGeometry StartPoint="0,0" EndPoint="0.5,0.5" />
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource MarkerDrawingColor}" Thickness="0.3" StartLineCap="Round" EndLineCap="Round" />
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <LineGeometry StartPoint="0,1" EndPoint="0.5,0.5" />
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource MarkerDrawingColor}" Thickness="0.3" StartLineCap="Round" EndLineCap="Round" />
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <LineGeometry StartPoint="0.9,0" EndPoint="0.9,1" />
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
    </DrawingGroup>

    <!--Add New-->
    <DrawingGroup x:Key="AddNew">
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource MarkerDrawingColor}" Thickness="0.3" StartLineCap="Round" EndLineCap="Round" />
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <LineGeometry StartPoint="0,0.5" EndPoint="1,0.5" />
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource MarkerDrawingColor}" Thickness="0.3" StartLineCap="Round" EndLineCap="Round" />
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <LineGeometry StartPoint="0.5,0" EndPoint="0.5,1" />
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
    </DrawingGroup>
    
    <!--Remove-->
    <DrawingGroup x:Key="RemoveItem">
        <GeometryDrawing>
            <GeometryDrawing.Pen>
                <Pen Brush="{StaticResource MarkerDrawingColor}" Thickness="0.005" StartLineCap="Round" EndLineCap="Round" />
            </GeometryDrawing.Pen>
            <GeometryDrawing.Geometry>
                <LineGeometry StartPoint="0.49,1.2" EndPoint="0.51,1.2" />
            </GeometryDrawing.Geometry>
        </GeometryDrawing>
    </DrawingGroup>

    <!--Marker Template-->
    <ControlTemplate x:Key="MarkerTemplate" TargetType="{x:Type local:Marker}">
        <Image x:Name="PART_Image" Width="20" Height="20" Grid.Column="0" VerticalAlignment="Center" ToolTip="{TemplateBinding ToolTip}" SnapsToDevicePixels="True" UseLayoutRounding="True"
               Source="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CurrentImage}">
            <Image.LayoutTransform>
                <ScaleTransform ScaleX="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Scaling}" ScaleY="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Scaling}" />
            </Image.LayoutTransform>
        </Image>
    </ControlTemplate>

    <!--Marker-->
    <Style x:Key="DefaultMarkerStyle" TargetType="{x:Type local:Marker}">
        <Setter Property="MarkerType" Value="FieldTracker" />
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Template" Value="{StaticResource MarkerTemplate}"/>
    </Style>

    <!--DataForm Header Template-->
    <ControlTemplate x:Key="DataFormHeaderTemplate" TargetType="{x:Type local:DataFormHeader}">
        <Border BorderThickness="0,0,0,1" BorderBrush="Black" Background="{TemplateBinding Background}" Focusable="False">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <TextBlock VerticalAlignment="Center" Margin="5,0,0,0" Text="{TemplateBinding Title}" />
                <StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right" Focusable="False">
                    <ctl:ToolbarButton Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:DataForm}}, Path=MoveFirstCommand}"
                                       Image="{TemplateBinding MoveFirstImage}"
                                       ButtonHeight="{TemplateBinding ButtonHeight}">
                    </ctl:ToolbarButton>
                    <ctl:ToolbarButton Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:DataForm}}, Path=MovePreviousCommand}"
                                       Image="{TemplateBinding MovePreviousImage}"
                                       ButtonHeight="{TemplateBinding ButtonHeight}">
                    </ctl:ToolbarButton>
                    <ctl:ToolbarButton Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:DataForm}}, Path=MoveNextCommand}"
                                       Image="{TemplateBinding MoveNextImage}"
                                       ButtonHeight="{TemplateBinding ButtonHeight}">
                    </ctl:ToolbarButton>
                    <ctl:ToolbarButton Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:DataForm}}, Path=MoveLastCommand}"
                                       Image="{TemplateBinding MoveLastImage}"
                                       ButtonHeight="{TemplateBinding ButtonHeight}">
                    </ctl:ToolbarButton>
                    <ctl:ToolbarSeparator Height="{TemplateBinding SeparatorHeight}"/>
                    <ctl:ToolbarButton Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:DataForm}}, Path=AddCommand}"
                                       Image="{TemplateBinding AddImage}"
                                       ButtonHeight="{TemplateBinding ButtonHeight}"
                                       IsEnabled="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:DataForm}}, Path=AllowAddNew}"/>
                    <ctl:ToolbarButton Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:DataForm}}, Path=RemoveCommand}"
                                       Image="{TemplateBinding RemoveImage}"
                                       ButtonHeight="{TemplateBinding ButtonHeight}"
                                       IsEnabled="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:DataForm}}, Path=AllowRemove}"/>
                </StackPanel>
            </Grid>
        </Border>
    </ControlTemplate>
    
    <!--DataForm Header Style-->
    <Style x:Key="DataFormHeaderStyle" TargetType="{x:Type local:DataFormHeader}">
        <Setter Property="ButtonHeight" Value="14" />
        <Setter Property="SeparatorHeight" Value="20" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Background" Value="WhiteSmoke" />
        <Setter Property="MoveFirstImage">
            <Setter.Value>
                <DrawingImage Drawing="{StaticResource MoveFirst}" />
            </Setter.Value>
        </Setter>
        <Setter Property="MovePreviousImage">
            <Setter.Value>
                <DrawingImage Drawing="{StaticResource MovePrevious}" />
            </Setter.Value>
        </Setter>
        <Setter Property="MoveNextImage">
            <Setter.Value>
                <DrawingImage Drawing="{StaticResource MoveNext}" />
            </Setter.Value>
        </Setter>
        <Setter Property="MoveLastImage">
            <Setter.Value>
                <DrawingImage Drawing="{StaticResource MoveLast}" />
            </Setter.Value>
        </Setter>
        <Setter Property="AddImage">
            <Setter.Value>
                <DrawingImage Drawing="{StaticResource AddNew}" />
            </Setter.Value>
        </Setter>
        <Setter Property="RemoveImage">
            <Setter.Value>
                <DrawingImage Drawing="{StaticResource RemoveItem}" />
            </Setter.Value>
        </Setter>
    </Style>

    <!--DataForm Footer Template-->
    <ControlTemplate x:Key="DataFormFooterTemplate" TargetType="{x:Type local:DataFormFooter}">
        <Border Focusable="False"
                BorderBrush="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:DataForm}}, Path=BorderBrush}"
                BorderThickness="0,1,0,0" 
                CornerRadius="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:DataForm}}, Path=CornerRadius}"
                Opacity="0.8" >
            <Grid>
                <!--DescriptionBar-->
                <StackPanel Orientation="Horizontal" MinHeight="20" 
                            Background="{TemplateBinding Background}" 
                            Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=HasError, Converter={StaticResource ReverseBooleanToVisibilityConverter}}">
                    <Image x:Name="PART_DescriptonImage" VerticalAlignment="Center" Height="16" Width="16" Margin="4,4,0,4"
                           Source="{TemplateBinding DescriptionImage}">
                        <Image.LayoutTransform>
                            <ScaleTransform ScaleX="1.5" ScaleY="1.5" />
                        </Image.LayoutTransform>
                    </Image>
                    <TextBlock Margin="5,4,4,4" TextWrapping="NoWrap" VerticalAlignment="Center"
                            Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=DescriptionText}" />
                </StackPanel>
                
                <!--ErrorBar-->
                <StackPanel Opacity="1" Orientation="Horizontal" MinHeight="20" 
                            Background="{TemplateBinding ErrorBackground}" 
                            Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=HasError, Converter={StaticResource BooleanToVisibilityConverter}}">
                    <Image x:Name="PART_ErrorImage" VerticalAlignment="Center" Height="18" Width="18" Margin="4,4,0,4"
                           Source="{TemplateBinding ErrorImage}" >
                        <Image.LayoutTransform>
                            <ScaleTransform ScaleX="1.5" ScaleY="1.5" />
                        </Image.LayoutTransform>
                    </Image>
                    <TextBlock Margin="5,4,4,4" TextWrapping="Wrap" VerticalAlignment="Center"
                               Foreground="{TemplateBinding ErrorForeground}"
                               Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ErrorText}" />
                </StackPanel>
            </Grid>
        </Border>
    </ControlTemplate>
    
    <!--DataForm Footer Style-->
    <Style x:Key="DataFormFooterStyle" TargetType="{x:Type local:DataFormFooter}">
        <Setter Property="Background" Value="WhiteSmoke" />
        <Setter Property="ErrorBackground" Value="Red" />
        <Setter Property="ErrorForeground" Value="White" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="ErrorImage">
            <Setter.Value>
                <DrawingImage Drawing="{StaticResource ErrorMarkerFooter}" />
            </Setter.Value>
        </Setter>
        <Setter Property="DescriptionImage">
            <Setter.Value>
                <DrawingImage Drawing="{StaticResource InfoMarker}" />
            </Setter.Value>
        </Setter>
    </Style>

    <!--DataForm-->
    <Style TargetType="{x:Type local:DataForm}">
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Padding" Value="10,10,10,0" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Background" Value="White" />
        <Setter Property="BorderBrush" Value="Black" />
        <Setter Property="CornerRadius" Value="0" />
        <Setter Property="HeaderTemplate" Value="{StaticResource DataFormHeaderTemplate}" />
        <Setter Property="HeaderStyle" Value="{StaticResource DataFormHeaderStyle}" />
        <Setter Property="FooterTemplate" Value="{StaticResource DataFormFooterTemplate}" />
        <Setter Property="FooterStyle" Value="{StaticResource DataFormFooterStyle}" />
        <Setter Property="MarkerStyle" Value="{StaticResource DefaultMarkerStyle}" />
        <Setter Property="Effect" Value="{StaticResource DataFormDropShadow}" />
        <Setter Property="AllowAddNew" Value="True"/>
        <Setter Property="AllowRemove" Value="True"/>
        <Setter Property="BusyIndicatorType" Value="Wheel" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:DataForm}">
                    <Border
                        Focusable="False"
                        IsEnabled="{TemplateBinding IsEnabled}"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        CornerRadius="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CornerRadius}">

                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal">
                                    <Storyboard FillBehavior="HoldEnd">
                                        <DoubleAnimation Storyboard.TargetName="EnableFrame" 
											                 Storyboard.TargetProperty="Opacity" 
											                 To="0" Duration="0:0:1" />
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:1" Storyboard.TargetName="EnableFrame" Storyboard.TargetProperty="(Border.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard FillBehavior="HoldEnd">
                                        <DoubleAnimation Storyboard.TargetName="EnableFrame"
											                 Storyboard.TargetProperty="Opacity" 
											                 To="0.3" Duration="0:0:001" />
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" FillBehavior="HoldEnd" Storyboard.TargetName="EnableFrame" Storyboard.TargetProperty="(Border.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <Grid x:Name="FormGrid" Opacity="{TemplateBinding Opacity}">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>

                            <!--Header-->
                            <local:DataFormHeader Grid.Row="0" Focusable="False"
                                                  Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ShowHeader, Converter={StaticResource BooleanToVisibilityConverter}}"
                                                  Style="{TemplateBinding HeaderStyle}"
                                                  TextElement.FontWeight="800"
                                                  Template="{TemplateBinding HeaderTemplate}"
                                                  Title="{TemplateBinding Title}"/>
                            
                            <!--Items-->
                            <ScrollViewer Grid.Row="1" Focusable="False"
                                          Margin="{TemplateBinding Padding}" 
                                          ScrollViewer.VerticalScrollBarVisibility="Auto" 
                                          ScrollViewer.HorizontalScrollBarVisibility="Auto">
                                <Grid x:Name="PART_Items">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                </Grid>
                            </ScrollViewer>

                            <!--Footer-->
                            <local:DataFormFooter x:Name="PART_Footer" Grid.Row="2" Focusable="False"
                                                  Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ShowFooter, Converter={StaticResource BooleanToVisibilityConverter}}"
                                                  Template="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=FooterTemplate}"
                                                  Style="{TemplateBinding FooterStyle}"
                                                  HasError="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=HasError}"
                                                  ErrorText="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Error}"
                                                  DescriptionText="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CurrentStatusText}"/>
                            
                            <Border x:Name="EnableFrame" Background="Gray" Visibility="Collapsed" Grid.RowSpan="3" Opacity="0" Focusable="False"/>

                            <ctl:BusyIndicator x:Name="busyIndicator" Grid.Row="1" Focusable="False"
                                               IsBusy="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsBusy}"
                                               IndicatorType="{TemplateBinding BusyIndicatorType}"
                                               IndicatorTemplate="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BusyIndicatorTemplate}"/>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--<DataTemplate x:Key="ItemsTemplate">
        <Grid x:Name="ItemsGrid">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <ContentPresenter x:Name="ItemHeader" Grid.Column="0" Content="{Binding Path=Header, Mode=OneTime}" Margin="0,0,0,20"/>
            <local:Marker x:Name="ItemLeftMarker" Grid.Column="1" MarkerType="{Binding Path=LeftMarkerType, Mode=OneTime}" Margin="0,0,0,20"/>
            <ContentPresenter x:Name="ItemContent" Grid.Column="2" Content="{Binding Path=Content, Mode=OneTime}" Margin="0,0,0,20"/>
            <local:Marker x:Name="ItemRightMarker" Grid.Column="3" MarkerType="{Binding Path=RightMarkerType, Mode=OneTime}" Margin="0,0,0,20"/>
        </Grid>
    </DataTemplate>-->
    
    <!--NumericUpDown-->
    <Style TargetType="{x:Type ctl:NumericUpDown}">
        <Setter Property="Height" Value="23" />
        <Setter Property="MinWidth" Value="30" />
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ctl:NumericUpDown}">
                    <Grid Height="{TemplateBinding Height}" IsEnabled="{TemplateBinding IsEnabled}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>

                        <TextBox x:Name="PART_TextBox" Grid.Column="0"
                                 TextAlignment="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ValueAlignment}"
                                 VerticalAlignment="Center"
                                 HorizontalAlignment="Stretch"
                                 Height="{TemplateBinding Height}"
                                 IsEnabled="{TemplateBinding IsEnabled}"
                                 IsReadOnly="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsReadOnly}"
                                 />

                        <Grid Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ShowButtons, Converter={StaticResource BooleanToVisibilityConverter}}" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Top"
                              IsEnabled="{TemplateBinding IsReadOnly, Converter={StaticResource ReverseBooleanConverter}}">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>

                            <Button x:Name="PART_UpButton" Grid.Row="0" Margin="-1,0,0,0" Padding="4" Height="{TemplateBinding Height}" Focusable="False" IsEnabled="{TemplateBinding IsEnabled}">
                                <Button.LayoutTransform>
                                    <ScaleTransform CenterX="0" CenterY="0" ScaleX="0.5" ScaleY="0.5" />
                                </Button.LayoutTransform>
                                <Image>
                                    <Image.Source>
                                        <DrawingImage>
                                            <DrawingImage.Drawing>
                                                <DrawingGroup>
                                                    <GeometryDrawing>
                                                        <GeometryDrawing.Pen><!--DashStyle="DotDot"-->
                                                            <Pen Brush="Black" Thickness="0.2" StartLineCap="Round"  EndLineCap="Square" />
                                                        </GeometryDrawing.Pen>
                                                        <GeometryDrawing.Geometry>
                                                            <LineGeometry StartPoint="0.5,0.25" EndPoint="0,0.75" />
                                                        </GeometryDrawing.Geometry>
                                                    </GeometryDrawing>
                                                    <GeometryDrawing>
                                                        <GeometryDrawing.Pen>
                                                            <Pen Brush="Black" Thickness="0.2" StartLineCap="Round"  EndLineCap="Square" />
                                                        </GeometryDrawing.Pen>
                                                        <GeometryDrawing.Geometry>
                                                            <LineGeometry StartPoint="0.5,0.25" EndPoint="1,0.75" />
                                                        </GeometryDrawing.Geometry>
                                                    </GeometryDrawing>
                                                </DrawingGroup>
                                            </DrawingImage.Drawing>
                                        </DrawingImage>
                                    </Image.Source>
                                </Image>
                            </Button>

                            <Button x:Name="PART_DownButton" Grid.Row="1" Margin="-1,0,0,0" Padding="4" Height="{TemplateBinding Height}" Focusable="False" IsEnabled="{TemplateBinding IsEnabled}">
                                <Button.LayoutTransform>
                                    <ScaleTransform CenterX="0" CenterY="0" ScaleX="0.5" ScaleY="0.5" />
                                </Button.LayoutTransform>
                                <Image>
                                    <Image.Source>
                                        <DrawingImage>
                                            <DrawingImage.Drawing>
                                                <DrawingGroup>
                                                    <GeometryDrawing>
                                                        <GeometryDrawing.Pen>
                                                            <Pen Brush="Black" Thickness="0.2" StartLineCap="Round"  EndLineCap="Square" />
                                                        </GeometryDrawing.Pen>
                                                        <GeometryDrawing.Geometry>
                                                            <LineGeometry StartPoint="0.5,0.75" EndPoint="0,0.25" />
                                                        </GeometryDrawing.Geometry>
                                                    </GeometryDrawing>
                                                    <GeometryDrawing>
                                                        <GeometryDrawing.Pen>
                                                            <Pen Brush="Black" Thickness="0.2" StartLineCap="Round"  EndLineCap="Square" />
                                                        </GeometryDrawing.Pen>
                                                        <GeometryDrawing.Geometry>
                                                            <LineGeometry StartPoint="0.5,0.75" EndPoint="1,0.25" />
                                                        </GeometryDrawing.Geometry>
                                                    </GeometryDrawing>
                                                </DrawingGroup>
                                            </DrawingImage.Drawing>
                                        </DrawingImage>
                                    </Image.Source>
                                </Image>
                            </Button>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--Empty Error Template-->
    <ControlTemplate x:Key="EmptyErrorTemplate">
        <AdornedElementPlaceholder Name="fieldAdorner" />
    </ControlTemplate>

    <!--Toolbar Border-->
    <LinearGradientBrush x:Key="ToolbarBorder" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FFC1D0DE"/>
        <GradientStop Color="#FF9EBFDB" Offset="1"/>
    </LinearGradientBrush>

    <!--Toolbar Background-->
    <LinearGradientBrush x:Key="ToolbarBackground" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FFCFDDEF" Offset="0.145"/>
        <GradientStop Color="#FFD8E3F3"/>
        <GradientStop Color="#FFC8D9ED" Offset="0.148"/>
        <GradientStop Color="#FFF5F7F9" Offset="1"/>
    </LinearGradientBrush>

    <!--Toolbar-->
    <Style TargetType="controls:ToolBar">
        <Setter Property="Background" Value="{StaticResource ToolbarBackground}" />
        <Setter Property="BorderBrush" Value="{StaticResource ToolbarBorder}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:ToolBar">
                    <Border Padding="5" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="3">
                        <ItemsPresenter />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Horizontal" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--ToolbarSeparator-->
    <Style TargetType="{x:Type ctl:ToolbarSeparator}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ctl:ToolbarSeparator}">
                    <Border BorderThickness="0.8" BorderBrush="LightGray"  Margin="0" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--Toolbar Button-->
    <Style TargetType="ctl:ToolbarButton">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Foreground" Value="#FF000000"/>
        <Setter Property="Padding" Value="3"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Opacity" Value="1"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ctl:ToolbarButton">
                    <Grid x:Name="mainGrid" Opacity="{TemplateBinding Opacity}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BackgroundAnimation"/>
                                        <ColorAnimation Duration="0" To="#FFFDDFBB" Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="BackgroundGradient"/>
                                        <ColorAnimation Duration="0" To="#FFFDEAD5" Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="BackgroundGradient"/>
                                        <ColorAnimation Duration="0" To="#FFFFCE69" Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)" Storyboard.TargetName="BackgroundGradient"/>
                                        <ColorAnimation Duration="0" To="#FFFFFCD4" Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)" Storyboard.TargetName="BackgroundGradient"/>
                                        <ColorAnimation Duration="0" To="#FFFFB700" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" Storyboard.TargetName="Background" />
                                        <ColorAnimation Duration="0" To="#FFFFB700" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Storyboard.TargetName="Background" />
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.BorderThickness)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Thickness>1</Thickness>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ColorAnimation Duration="0" To="#FFFFB700" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" Storyboard.TargetName="Background"/>
                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BackgroundAnimation"/>
                                        <ColorAnimation Duration="0" To="#D8FFFFFF" Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="BackgroundGradient"/>
                                        <ColorAnimation Duration="0" To="#C6FFFFFF" Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="BackgroundGradient"/>
                                        <ColorAnimation Duration="0" To="#8CFFFFFF" Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)" Storyboard.TargetName="BackgroundGradient"/>
                                        <ColorAnimation Duration="0" To="#3FFFFFFF" Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)" Storyboard.TargetName="BackgroundGradient"/>
                                        <ColorAnimation Duration="0" To="#FFF79D00" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" Storyboard.TargetName="BackgroundAnimation" />
                                        <ColorAnimation Duration="0" To="#FFFFB700" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Storyboard.TargetName="Background" />
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.BorderThickness)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Thickness>1</Thickness>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To=".55" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="mainGrid"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                </VisualState>
                                <VisualState x:Name="Unfocused"/>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="Background" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3" BorderBrush="Transparent">
                            <Grid Background="{TemplateBinding Background}" Margin="0">
                                <Border x:Name="BackgroundAnimation" Background="Transparent" CornerRadius="3" Opacity="0" />
                                <Rectangle x:Name="BackgroundGradient" RadiusX="2" RadiusY="2">
                                    <Rectangle.Fill>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="Transparent" Offset="0.145"/>
                                            <GradientStop Color="Transparent"/>
                                            <GradientStop Color="Transparent" Offset="0.148"/>
                                            <GradientStop Color="Transparent" Offset="1"/>
                                        </LinearGradientBrush>
                                    </Rectangle.Fill>
                                </Rectangle>
                            </Grid>
                        </Border>
                        <Border Padding="5">
                            <Image x:Name="PART_Image" Margin="3" Height="{TemplateBinding ButtonHeight}" Width="{TemplateBinding ButtonHeight}" VerticalAlignment="Center"
                                    SnapsToDevicePixels="True" UseLayoutRounding="True" RenderOptions.BitmapScalingMode="Fant"  
                                    Source="{TemplateBinding Image}">
                            </Image>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--BusyIndicator Template: Wheel-->
    <ControlTemplate x:Key="IndicatorWheelTemplate">
        <Grid x:Name="LayoutRoot" Opacity="0" HorizontalAlignment="Center" VerticalAlignment="Center">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Normal">
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="LayoutRoot"
											             Storyboard.TargetProperty="Opacity" 
											             From="1" To="0" Duration="0:0:.25" />
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="IsBusy">
                        <Storyboard>
                            <DoubleAnimationUsingKeyFrames RepeatBehavior="Forever" 
                                                                       Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)"
                                                                       Storyboard.TargetName="ellipse0">
                                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="360"/>
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames RepeatBehavior="Forever"
                                                                       Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)"
                                                                       Storyboard.TargetName="ellipse1">
                                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="360"/>
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimation Storyboard.TargetName="LayoutRoot" 
											             Storyboard.TargetProperty="Opacity" 
											             From="0" To="1" Duration="0:0:.25" />
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Ellipse x:Name="ellipseLayer" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="27.5" Stroke="DarkBlue">
                <Ellipse.Effect>
                    <DropShadowEffect BlurRadius="15"/>
                </Ellipse.Effect>
            </Ellipse>
            <Ellipse x:Name="ellipse0" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="27.5"
				     Width="100" Height="100" RenderTransformOrigin="0.5,0.5">
                <Ellipse.RenderTransform>
                    <TransformGroup>
                        <ScaleTransform/>
                        <SkewTransform/>
                        <RotateTransform/>
                        <TranslateTransform/>
                    </TransformGroup>
                </Ellipse.RenderTransform>
                <Ellipse.Stroke>
                    <LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
                        <GradientStop Color="#FF081087" Offset="1"/>
                        <GradientStop Color="White"/>
                    </LinearGradientBrush>
                </Ellipse.Stroke>
            </Ellipse>
            <Ellipse x:Name="ellipse1" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="9.5"
			                     Width="85" Height="85" RenderTransformOrigin="0.5,0.5">
                <Ellipse.RenderTransform>
                    <TransformGroup>
                        <ScaleTransform/>
                        <SkewTransform/>
                        <RotateTransform/>
                        <TranslateTransform/>
                    </TransformGroup>
                </Ellipse.RenderTransform>
                <Ellipse.Stroke>
                    <LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
                        <GradientStop Color="#FF5674BC"/>
                        <GradientStop Color="White" Offset="1"/>
                    </LinearGradientBrush>
                </Ellipse.Stroke>
            </Ellipse>
            <Ellipse x:Name="ellipse2" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="1.5"
			                     Width="50" Height="50" RenderTransformOrigin="0.5,0.5" Stroke="#FF31478D">
            </Ellipse>
            <Ellipse x:Name="ellipse3" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="1.5"
			                     Width="60" Height="60" RenderTransformOrigin="0.5,0.5">
                <Ellipse.Stroke>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FF2450BA" Offset="0"/>
                        <GradientStop Color="White" Offset="1"/>
                    </LinearGradientBrush>
                </Ellipse.Stroke>
            </Ellipse>
            <Ellipse x:Name="ellipse4" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="1.5"
			                     Width="95" Height="95" RenderTransformOrigin="0.5,0.5">
                <Ellipse.Stroke>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FF304CA1" Offset="1"/>
                        <GradientStop Color="White"/>
                    </LinearGradientBrush>
                </Ellipse.Stroke>
            </Ellipse>
            <Ellipse x:Name="ellipse5" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="1.5"
			                     Width="75" Height="75" RenderTransformOrigin="0.5,0.5">
                <Ellipse.Stroke>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FF3548AF"/>
                        <GradientStop Color="White" Offset="1"/>
                    </LinearGradientBrush>
                </Ellipse.Stroke>
            </Ellipse>
        </Grid>
    </ControlTemplate>

    <!--BusyIndicator Template: Dots-->
    <ControlTemplate x:Key="IndicatorDotsTemplate">
        <Canvas x:Name="LayoutRoot" Opacity="0" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Center" 
                VerticalAlignment="Center" Width="100" Height="100" >
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Normal">
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="LayoutRoot"
											             Storyboard.TargetProperty="Opacity" 
											             From="1" To="0" Duration="0:0:.25" />
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="IsBusy">
                        <Storyboard>
                            <DoubleAnimationUsingKeyFrames RepeatBehavior="Forever" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="LayoutRoot">
                                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="360"/>
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimation Storyboard.TargetName="LayoutRoot" 
											             Storyboard.TargetProperty="Opacity" 
											             From="0" To="1" Duration="0:0:.25" />
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Canvas.RenderTransform>
                <TransformGroup>
                    <ScaleTransform/>
                    <SkewTransform/>
                    <RotateTransform/>
                    <TranslateTransform/>
                </TransformGroup>
            </Canvas.RenderTransform>
            <Path Data="M20,10 C20,15.522847 15.522847,20 10,20 C4.4771525,20 0,15.522847 0,10 C0,4.4771525 4.4771525,0 10,0 C15.522847,0 20,4.4771525 20,10 z" Fill="#FF487CC2" Height="20" Canvas.Left="11" Opacity="0.9" Stretch="Fill" Canvas.Top="11" Width="20"/>
            <Path Data="M20,10 C20,15.522847 15.522847,20 10,20 C4.4771525,20 0,15.522847 0,10 C0,4.4771525 4.4771525,0 10,0 C15.522847,0 20,4.4771525 20,10 z" Fill="#FF487CC2" Height="20" Canvas.Left="0" Opacity="0.8" Stretch="Fill" Canvas.Top="40" Width="20" />
            <Path Data="M20,10 C20,15.522847 15.522847,20 10,20 C4.4771525,20 0,15.522847 0,10 C0,4.4771525 4.4771525,0 10,0 C15.522847,0 20,4.4771525 20,10 z" Fill="#FF487CC2" Height="20" Canvas.Left="69" Opacity="0.3" Stretch="Fill" Canvas.Top="11" Width="20" />
            <Path Data="M20,10 C20,15.522847 15.522847,20 10,20 C4.4771525,20 0,15.522847 0,10 C0,4.4771525 4.4771525,0 10,0 C15.522847,0 20,4.4771525 20,10 z" Fill="#FF487CC2" Height="20" Canvas.Left="80" Opacity="0.4" Stretch="Fill" Canvas.Top="40" Width="20" />
            <Path Data="M20,10 C20,15.522847 15.522847,20 10,20 C4.4771525,20 0,15.522847 0,10 C0,4.4771525 4.4771525,0 10,0 C15.522847,0 20,4.4771525 20,10 z" Fill="#FF487CC2" Height="20" Canvas.Left="11" Opacity="0.7" Stretch="Fill" Canvas.Top="69" Width="20" />
            <Path Data="M20,10 C20,15.522847 15.522847,20 10,20 C4.4771525,20 0,15.522847 0,10 C0,4.4771525 4.4771525,0 10,0 C15.522847,0 20,4.4771525 20,10 z" Fill="#FF487CC2" Height="20" Canvas.Left="40" Opacity="0.6" Stretch="Fill" Canvas.Top="80" Width="20" />
            <Path Data="M20,10 C20,15.522847 15.522847,20 10,20 C4.4771525,20 0,15.522847 0,10 C0,4.4771525 4.4771525,0 10,0 C15.522847,0 20,4.4771525 20,10 z" Fill="#FF487CC2" Height="20" Canvas.Left="69" Opacity="0.5" Stretch="Fill" Canvas.Top="69" Width="20" />
            <Path Data="M20,10 C20,15.522847 15.522847,20 10,20 C4.4771525,20 0,15.522847 0,10 C0,4.4771525 4.4771525,0 10,0 C15.522847,0 20,4.4771525 20,10 z" Fill="#FF487CC2" Height="20" Canvas.Left="40" Opacity="0.2" Stretch="Fill" Canvas.Top="0" Width="20" />
        </Canvas>
    </ControlTemplate>
    
    <!--BusyIndicator-->
    <Style TargetType="{x:Type ctl:BusyIndicator}">
        <Setter Property="Template" Value="{StaticResource IndicatorWheelTemplate}" />
    </Style>

</ResourceDictionary>
